package files;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class PP {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		final String tag = "017E";
		final char ind = 'e';
		final String rawData =
			"\n017E ƒaListeNSWƒbAkathDeutschl - Adressb. kath. Dtschl."
				+ "ƒegƒekƒD12-09-01\n"
				+ "017E ƒaListeNSWƒbAkathDeutschl - Adressb. kath. Dtschl."
				+ "ƒegƒekƒD12-09-01\n";
		String linePatStr = "^" + tag + ".*$";
		Pattern linePat = Pattern.compile(linePatStr, Pattern.MULTILINE);
		Matcher lineMat = linePat.matcher(rawData);
		while (lineMat.find()) {
			String line = lineMat.group();
			String subfieldStr = "ƒ" + ind + "([^ƒ]*)";
			Pattern subfieldPat =
				Pattern.compile(subfieldStr, Pattern.MULTILINE);
			Matcher subMatcher = subfieldPat.matcher(line);
			while (subMatcher.find()) {
				System.out.println(subMatcher.group(1));
			}
		}
	}
}
